import * as PIXI from 'pixi.js'
import { Broadcaster, EventType, Listener } from '../broadcaster/Broadcaster'
import { GameAudio } from '../audio/audio'
import { Background } from '../background';
import { LoadResource } from '../loadResource';
import { CardController } from '../card/cardController';
import { PlayerController } from '../player/playerController';
import { GameOver } from '../gameOver';
type AppType = PIXI.Application<PIXI.ICanvas>


export class Manager extends Listener {  // 管理前端渲染等具体逻辑类
    gameMusic: GameAudio;
    constructor(
        public app: AppType,
        public windowWidth: number,
        public windowHeight: number,
    ) {
        super()
        this.init()
    }
    init() {
        this.gameMusic = new GameAudio()
        new Background(this.app)
        new PlayerController(this.app)
        new CardController(this.app)
        new GameOver(this.app)
        new LoadResource(this.app, this.gameMusic)
    }
    notify(caster: Broadcaster, event: EventType): void {
    }

    destoryed() {
        this.gameMusic.unMounted()
    }
}